Skip to content

subclass IPython.core.display HTML object for more flexibility. #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 22, 2014

Conversation

theengineear
Copy link
Contributor

By defining _repr_*_ functions, IPython will just call these
functions when a non-HTML representation is required.

By defining `_repr_*_` functions, IPython will just call these
functions when a non-HTML representation is required.
@theengineear
Copy link
Contributor Author

Probably not ready to be pulled in just yet... I'd rather we just had IPython as a dependency and then we could move these definitions into plotly.py. Thoughts?
@etpinard, @chriddyp

@etpinard
Copy link
Contributor

👍 for doing this.

I have mixed feelings about making IPython a dependency for plotly.

Yes plotly is at its best inside IPython notebooks (so it might a good idea to force users to use IPython).
But then again, I feel this could push some users away.

@theengineear
Copy link
Contributor Author

ok, yeah, i think i'm leaning that way too. just wanted another opinion on it. we can probably do something like this:

if _ipython_imported:
    class PlotlyFrame(ipython.core.display.HTML):
        # blah blah

That way it's private (well... not there at all really) if folks don't have ipython, it's not defined dynamically, which is not really an appropriate solution here, and we can put it whereverz. it's sort of like this: https://github.com/plotly/python-api/blob/master/plotly/tools.py#L27-31

Seem alright?

@etpinard
Copy link
Contributor

@theengineear good call.

If you have matplotlib installed already then plotly has something for you, but if you don't: no worries.
And similarly, if you have ipython installed then plotly has also something for you.

💃

@chriddyp
Copy link
Member

luv it - def shouldn't be a requirement!

On Mon, Aug 18, 2014 at 4:18 PM, Étienne Tétreault-Pinard <
[email protected]> wrote:

@theengineear https://github.com/theengineear good call.

If you have matplotlib installed already then plotly has something for
you.
And similarly, if your have ipython installed then plotly has also
something for you.

[image: 💃]


Reply to this email directly or view it on GitHub
#107 (comment).


def svg_worker(display_obj, results):
img = display_obj._repr_svg_()
if img[:4] == '<svg':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyone know a way to check if a file is valid svg? (i'm guessing this is not a good way to do it...) (imghdr lib doesn't help...)

@theengineear
Copy link
Contributor Author

k, pretty sure everyone is onboard. merging.

theengineear added a commit that referenced this pull request Aug 22, 2014
subclass IPython.core.display HTML object for more flexibility.
@theengineear theengineear merged commit fc0ab00 into master Aug 22, 2014
@theengineear theengineear deleted the plotly-goes-static branch August 22, 2014 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants